package jtk.project4.fleet.service;

import java.sql.SQLException;
import java.util.List;

import jtk.project4.fleet.domain.EmployeeC;
import jtk.project4.fleet.domain.FuelRec;
import jtk.project4.fleet.domain.LaborAsc;
import jtk.project4.fleet.domain.Customers;
import jtk.project4.fleet.domain.History;
import jtk.project4.fleet.domain.Lists;
import jtk.project4.fleet.domain.MeterLog;

import jtk.project4.fleet.domain.Odometer;
import jtk.project4.fleet.domain.PmHist;
import jtk.project4.fleet.domain.Po;
import jtk.project4.fleet.domain.PoD;
import jtk.project4.fleet.domain.RbDept;
import jtk.project4.fleet.domain.RbLoc;
import jtk.project4.fleet.domain.TireInv;
import jtk.project4.fleet.domain.Payments;
import jtk.project4.fleet.domain.Invoices;
import jtk.project4.fleet.domain.Vendor;
import jtk.project4.fleet.ibatis.dao.CustomersDao;
import jtk.project4.fleet.ibatis.dao.EmployeecsDao;
import jtk.project4.fleet.ibatis.dao.FuelRecDao;
import jtk.project4.fleet.ibatis.dao.HistoryDao;
import jtk.project4.fleet.ibatis.dao.MeterLogDao;

import jtk.project4.fleet.ibatis.dao.OdometerDao;
import jtk.project4.fleet.ibatis.dao.PmHistDao;


import jtk.project4.fleet.ibatis.dao.LaborascDao;

import jtk.project4.fleet.ibatis.dao.PoDDao;

import jtk.project4.fleet.ibatis.dao.PoDao;
import jtk.project4.fleet.ibatis.dao.RbDeptDao;
import jtk.project4.fleet.ibatis.dao.RbLocDao;
import jtk.project4.fleet.ibatis.dao.TireInvDao;
import jtk.project4.fleet.ibatis.dao.VendorsDao;

import jtk.project4.fleet.ibatis.dao.LaborascDao;
import jtk.project4.fleet.ibatis.dao.LaborascDao;
import jtk.project4.fleet.ibatis.dao.PaymentsDao;
import jtk.project4.fleet.ibatis.dao.InvoicesDao;


public class DatabaseService {
	
	private static DatabaseService service;
	private VendorsDao vendorsDao;
	private LaborascDao laborascsDao;
	private TireInvDao tireinvDao;
	private RbDeptDao rbDeptDao;
	private RbLocDao rbLocDao;
	private MeterLogDao meterlogDao;
	private PaymentsDao paymentsDao;
	private InvoicesDao invoicesDao;
	private PoDDao poDDao;
	private EmployeecsDao employeecsDao;
	
	private CustomersDao customersDao;
	private PoDao poDao;
	private HistoryDao historyDao;

	private OdometerDao odometerDao;
//>>>>>>> .r108
	private PmHistDao pmHistsDao;
	private FuelRecDao fuelrecDao;
	private DatabaseService(){
		vendorsDao = new VendorsDao();

		laborascsDao = new LaborascDao();
		laborascsDao = new LaborascDao();
		meterlogDao = new MeterLogDao();
		customersDao = new CustomersDao();
		poDao = new PoDao();
		historyDao = new HistoryDao();
		tireinvDao = new TireInvDao();
		employeecsDao = new EmployeecsDao();

		odometerDao = new OdometerDao();
		pmHistsDao = new PmHistDao();
		paymentsDao = new PaymentsDao();
		invoicesDao = new InvoicesDao();
		poDDao = new PoDDao();
		fuelrecDao = new FuelRecDao();


	}
	
	
	public static DatabaseService getInstance(){
		if(service == null){
			service = new DatabaseService();
		}
		return service;
	}
	
	public List<Vendor> getVendors() throws SQLException 
	{
		return vendorsDao.selectVendors();
	}
	

	public List<Odometer> getOdometers() throws SQLException 
	{
		return odometerDao.selectOdometer();
	}
	
	public List<LaborAsc> getLaborAscs() throws SQLException {
		return laborascsDao.selectLaborAsc();
	}



	
	
//	public List<LaborAsc> getVendors() throws SQLException {
//		return vendorsDao.selectlaborascs();
//	}
	
	public void setLaborascsDao(LaborascDao laborascsDao) {

		this.laborascsDao = laborascsDao;
	}


	public LaborascDao getLaborascsDao() {
		return laborascsDao;
	}

	
	public List<Customers> getCustomers() throws SQLException{
		return customersDao.selectCustomers();
	}
	
	public List<Po> getPo() throws SQLException{
		return poDao.selectPo();
	}
	
	public List <History> getHistory() throws SQLException{
		return historyDao.selectHistories();
	}

	public List<TireInv> getTireinvs() throws SQLException {
		return tireinvDao.selectTireInvs();
	}


	public List<MeterLog> getMeterLog() throws SQLException {
		return meterlogDao.selectMeterLog();
	}
	
//	public void setMeterlogDao(MeterLogDao meterlogDao) {
//		this.meterlogDao = meterlogDao;
//	}
//
//
//	public MeterLogDao getMeterlogDao() {
//		return meterlogDao;
//	}


	public List<EmployeeC> getEmployeecs() throws SQLException {
		return employeecsDao.selectEmployeecs();
	}


	
	
	public List<RbDept> getRbDept() throws SQLException {
		return rbDeptDao.selectRbDept();
	}
	
	
	
	
	public List<RbLoc> getRbLoc() throws SQLException {
		return rbLocDao.selectRbLocs();
	}


//	public void setOdometerDao(OdometerDao odometerDao) {
//		this.odometerDao = odometerDao;
//	}


	public OdometerDao getOdometerDao() {
		return odometerDao;
	}

	
	public List<PmHist> getPmHists() throws SQLException {
		return pmHistsDao.selectPmHists();
	}




	public List<Payments> getPayments()throws SQLException {
		return paymentsDao.selectPayments();
	}
	
	public List<Invoices> getInvoices()throws SQLException {
		return invoicesDao.selectInvoices();
	}
	
	public List<PoD> getPoDs() throws SQLException {
		return poDDao.selectPoD();
	}
	
	public List<FuelRec> getFuelRec() throws SQLException {
		return fuelrecDao.selectFuelRec();
	}

}